﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Forums.Domain.Values
{
	using System.Collections.Generic;
	using System.Web.Mvc;
	using Falcon.Core;
	using Falcon.Forums.Domain.Services;

	public class ForumTopicMove
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="ForumTopicMove"/> class.
		/// </summary>
		public ForumTopicMove()
		{
			this.ForumService = Application.Resolve<IForumService>();
		}

		/// <summary>
		/// Gets or sets the forum repository.
		/// </summary>
		/// <value>The forum repository.</value>
		public IForumService ForumService
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets or sets the forum id.
		/// </summary>
		/// <value>The forum id.</value>
		public int ForumId
		{
			get; 
			set;
		}

		/// <summary>
		/// Gets or sets the redirect.
		/// </summary>
		/// <value>The redirect.</value>
		public string Redirect
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the topics.
		/// </summary>
		/// <value>The topics.</value>
		public IList<ForumTopic> Topics
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the topics to move.
		/// </summary>
		/// <value>The topics to move.</value>
		public ForumTopicUpdateValue[] TopicsToMove
		{
			get;
			set;
		}

		/// <summary>
		/// Gets the parents.
		/// </summary>
		/// <value>The parents.</value>
		public SelectList Forums
		{
			get
			{
				return new SelectList(ForumService.GetAll(), "Id", "Title", this.ForumId);
			}
		}
	}
}